// self
@import './partials/defaults';
@import './partials/vars';
@import './partials/vue';
@import './partials/loaders';
@import './partials/utils';
@import './packages/animate';
@import './packages/progress';
@import './packages/switcher';
@import './modules/usage-intro';
@import './modules/media_player';

.media-manager {
    &.top-space {
        padding-top: 2rem;
    }
}

/*                toolbar                */
.media-manager__toolbar {
    background-color: darken($active_theme, 2.5%);
    border: 1px solid darken($active_theme, 5%);
    border-radius: 4px 4px 0 0;
    flex-wrap: wrap;
    margin: 0 0 -1px !important;
    padding: 1rem;
}

@include media('max', 768) {
    .media-manager__toolbar {
        .level-left + .level-right {
            margin-top: 0.75rem;
        }
    }
}

/*                upload                */
.media-manager__dz {
    border-radius: 5px;
    height: 0;
    margin: 0;
    opacity: 0;
    padding: 0;
    transition: all $anim-time $anim-ease;
    visibility: hidden;
}

.__dz-active {
    border: 2px $dashed-border;
    border-radius: 5px;
    height: unset;
    margin: 15px 0;
    opacity: unset;
    padding: 3px;
    visibility: unset;
}

#new-upload {
    background-color: $black;
    background-position: center;
    background-repeat: repeat;
    border-radius: 5px;
    cursor: pointer;
    overflow: hidden;
    position: relative;
    transition: all $anim-time $anim-ease;

    &::before {
        background-image: var(--gradient);
        border-radius: 100vw;
        content: '';
        height: 25vw;
        left: 50%;
        opacity: 0.9;
        position: absolute;
        top: 50%;
        transform: translate(-50%, -50%);
        transition: all $anim-time $anim-ease;
        width: 25vw;
    }

    &:hover {
        box-shadow: $shadow_2;

        &::before {
            box-shadow: $shadow_2;
        }
    }

    .dz-message {
        color: $white;
        font-weight: 400;
        margin: 0;
        padding: 3em;
        position: relative;
        text-align: center;
    }

    .form-switcher,
    .save_link {
        position: absolute;
        z-index: 1;
    }

    .form-switcher {
        bottom: 0.5rem;
        left: 0.5rem;
    }

    .save_link {
        bottom: 0;
        filter: drop-shadow(0 0 0.1rem rgba($black, 0.3));
        right: 0.5rem;

        .circle,
        .anchor {
            transition: all $anim-time $anim-ease;
        }

        .circle {
            color: $active_theme;
        }

        .anchor {
            color: darken($active_theme, 50%);
        }

        &:hover {
            .anchor {
                color: $active_theme;
            }

            .circle {
                color: darken($active_theme, 50%);
            }
        }
    }
}

@include media('max', 1023) {
    #new-upload::before {
        height: 40vw;
        width: 40vw;
    }
}

@include media('max', 768) {
    #new-upload::before {
        height: 50vw;
        width: 50vw;
    }
}

#uploadProgress {
    margin: 1rem 0;
}

#uploadPreview {
    display: none;

    &.show {
        background-color: $active_theme;
        display: flex;
        height: 100%;
        left: 0;
        overflow: hidden;
        position: absolute;
        top: 0;
        width: 100%;
        z-index: 12;

        & ~ .__stack-files,
        & ~ .__stack-sidebar {
            filter: blur(5px);
            opacity: 0.25;
        }
    }

    .dz-preview-ops {
        display: flex;
        flex-direction: column;
    }

    .icon-btn {
        color: $black;
    }

    .btn-animate {
        button {
            color: $white;
            opacity: 0.7;
            transition: all $anim-time ease-out;

            &:hover {
                filter: drop-shadow(0 4px 6px rgba($black, 0.1));
                opacity: 1;
                transform: translateY(-0.2rem);
            }
        }
    }

    .sidebar-container {
        border-right: 2px $dashed-border;
        height: 100%;
        max-width: 20%;
        min-width: 20%;
        overflow-y: scroll;

        .sidebar {
            display: flex;
            flex-wrap: wrap;
        }
    }
}

@include media('max', 1023) {
    #uploadPreview.show {
        flex-direction: column;

        .sidebar-container {
            border-bottom: 2px $dashed-border;
            border-right: none;
            height: unset;
            max-width: unset;
            min-height: fit-content;
            overflow-x: auto;

            .sidebar {
                flex-wrap: nowrap;
            }
        }
    }
}

.dz-success-mark,
.dz-error-message,
.dz-error-mark,
.dz-details {
    display: none;
}

.dz-preview {
    display: flex;
    flex: 0 0 auto;
    padding: 1rem;
    position: relative;

    .dz-image img {
        border-radius: 8px;
        cursor: pointer;
        display: block;
        transition: all $anim-time $anim-ease;
    }

    .dz-remove {
        bottom: 1rem;
        display: block;
        position: absolute;
        right: 1rem;
    }

    .is-previewing {
        box-shadow: 0 20px 20px -20px darken($black, 0.3);
        transform: translateY(-10px);
    }
}

/*                manager                */
.media-manager__stack {
    border: 1px solid darken($active_theme, 5%);
    border-radius: 0 0 4px 4px;
    display: flex;
    flex-direction: column;
    position: relative;

    &::before {
        bottom: 0;
        box-shadow: $shadow_1;
        content: '';
        left: 0;
        position: absolute;
        right: 0;
        top: 20px;
    }
}

/*                breadcrump                */
// mobile
.__stack-breadcrumb-mobile {
    align-items: center;
    display: flex;
    list-style: none;
    overflow: scroll;
    padding: 1rem 0;
    transition: all $anim-time $anim-ease;
    width: 100%;

    li {
        border: 1px dashed darken($active_theme, 2.5%);
        border-radius: 5px;
        flex: 1;
        margin-right: 1rem;
        padding: 2px;
        position: relative;
        text-align: center;

        // ---
        &::after {
            border-top: 1px dashed darken($active_theme, 2.5%);
            content: '';
            position: absolute;
            right: -1rem;
            top: 50%;
            width: 1rem;
        }

        &:last-of-type {
            border: none;
            margin-left: 1px;
            margin-right: 2rem;

            &::after {
                display: none;
            }

            &::before {
                border: 1px dashed darken($active_theme, 2.5%);
                border-radius: 5px 0 0 5px;
                border-right: none;
                bottom: -1px;
                content: '';
                left: -1px;
                position: absolute;
                right: 75%;
                top: -1px;
            }
        }

        // ---•
        &:nth-last-of-type(2)::before {
            color: darken($active_theme, 2.5%);
            content: '•';
            font-size: 1.8rem;
            position: absolute;
            right: -1.45rem;
            top: 0.6rem;
            z-index: 1;
        }

        a,
        p {
            background-color: $white;
            border-radius: 5px;
            display: block;
            padding: 1rem;
            white-space: nowrap;
        }

        a {
            box-shadow: $shadow_3;
            color: $blue;
            transition: all $anim-time $anim-ease;

            &:hover {
                box-shadow: none;
            }
        }
    }
}

// default
.__stack-breadcrumb {
    background-color: $active_theme;
    border-top: 1px solid darken($active_theme, 5%);
    margin: 0 !important;
    padding: 0.75rem;

    .breadcrumb {
        margin-bottom: 0 !important;
        padding: 0;

        li {
            position: relative;

            &::before {
                color: darken($active_theme, 50%);
            }
        }

        a {
            color: $blue;
            font-weight: bold;
            padding: 0 0.5em;

            &:hover {
                color: darken($active_theme, 50%);
            }
        }

        p {
            margin: 0;
            padding: 0 0.5em;
        }
    }
}

.__stack-sidebar-toggle {
    align-items: flex-end;
    cursor: pointer;
    display: flex;
    position: relative;

    &:hover {
        * {
            color: darken($active_theme, 50%);
        }
    }

    span:not(.icon) {
        font-size: 0.8rem;
        font-weight: bold;
        margin-bottom: 1px;
        text-transform: uppercase;
    }
}

/*                files                */
.__stack-container {
    background-color: $white;
    display: flex;
    min-height: 50vh;
    overflow: hidden;
    position: relative;
    transition: all $anim-time $anim-ease;
    z-index: 1;

    &.more-height {
        min-height: 75vh;
    }

    &.dz-drag-hover {
        background-color: rgba($blue, 0.25);

        .__stack-files,
        .__stack-sidebar {
            filter: blur(5px);
            opacity: 0.25;
        }
    }
}

@include media('max', 1023) {
    .__stack-container {
        max-height: 75vh;
    }
}

// files list container
.__stack-files {
    bottom: 0;
    left: 20%;
    overflow-y: scroll;
    position: absolute;
    right: 0;
    top: 0;
    touch-action: initial !important;
    transition: all $anim-time $anim-ease;
    will-change: height, width, left, right;
}

.__stack-sidebar-hidden {
    left: 0;
}

.__files-boxs {
    display: flex;
    flex-wrap: wrap;
    list-style: none;
    padding: 0.75rem;
    padding-bottom: 5rem;
    user-select: none;

    li {
        display: flex;
        flex: 1;
        max-height: 100px;
        max-width: 250px;
        min-width: 250px;
    }
}

.__file-box {
    background-color: lighten($active_theme, 2.5%);
    border: 1px solid darken($active_theme, 2.5%);
    border-radius: 4px;
    color: darken($active_theme, 60%);
    cursor: pointer;
    display: flex;
    margin: 0.75rem;
    overflow: hidden;
    padding: 0.75rem;
    position: relative;
    transition: all $anim-time;
    width: 100%;

    &.selected,
    &.bulk-selected,
    &:hover {
        background-color: $blue;
        border-color: darken($blue, 5%);
        color: $white;

        h4,
        i,
        svg {
            color: $white;
        }
    }
}

.__box-lock-icon {
    border: none;
    border-radius: 100vw;
    height: 0.5rem;
    padding: 0;
    position: absolute;
    right: 3px;
    top: 3px;
    width: 0.5rem;
    z-index: 1;

    &:disabled {
        cursor: not-allowed;
    }
}

.__box-copy-link {
    bottom: 0;
    cursor: copy;
    position: absolute;
    right: 0;
}

.__box-data {
    align-items: center;
    display: flex;
    justify-content: flex-start;
    overflow: hidden;
    width: 100%;

    .__box-preview {
        color: darken($active_theme, 50%);
        margin-right: 0.75rem;

        .icon {
            display: flex;
        }

        .__box-img {
            border: 1px dashed darken($active_theme, 25%);
            border-radius: 4px;
            height: 50px;
            overflow: hidden;
            position: relative;
            width: 50px;

            img {
                height: 100%;
                left: 0;
                object-position: center;
                position: absolute;
                top: 0;
                width: 100%;
            }
        }
    }

    .__box-info {
        overflow: hidden;
        width: 100%;

        h4 {
            font-size: 1rem;
            margin: 0;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
        }

        small {
            font-size: 11px;
        }

        .__info-file-size {
            font-weight: bold;
            margin-left: 2px;
        }
    }
}

@include media('max', 1023) {
    .__stack-files {
        left: 0;
        position: relative;
        right: 0;
        width: 100%;
    }

    .__files-boxs {
        li {
            max-height: 200px;
            max-width: 200px;
            min-height: 200px;
            min-width: 200px;
        }
    }

    .__file-box {
        padding: 0;
    }

    .__box-copy-link {
        bottom: 1px;
        right: 1px;
    }

    .__box-data {
        align-self: unset;
        flex-direction: column;
        width: 100%;

        .__box-preview {
            align-items: center;
            display: flex;
            flex: 4;
            justify-content: center;
            margin: 0;
            overflow: hidden;
            width: 100%;

            svg {
                transform: scale(1.5);
            }

            .__box-img {
                border: none;
                border-radius: 0;
                height: 100%;
                width: 100%;

                img {
                    object-position: top;
                }
            }
        }

        .__box-info {
            padding: 0.75rem;
            width: 100%;
        }
    }
}

// info sidebar
.__stack-sidebar {
    background-color: $active_theme;
    border-right: 1px solid darken($active_theme, 5%);
    display: flex;
    flex-direction: column;
    min-width: 20%;
    position: relative;
    transition: all $anim-time $anim-ease;
    width: 20%;
    will-change: height, width, left, right;

    .__sidebar-preview {
        border-bottom: 1px $dashed-border;
        color: darken($active_theme, 50%);
        flex: 0 0 auto;
        text-align: center;

        .__sidebar-none-selected {
            align-items: center;
            display: flex;
            flex-direction: column;
            padding: 1rem 0 1.5rem;

            span {
                align-items: center;
                border: 2px dashed darken($active_theme, 15%);
                border-radius: 25px;
                display: flex;
                height: 175px;
                justify-content: center;
                margin: 1rem 0;
                width: 175px;
            }

            svg {
                filter: drop-shadow(0.3rem 0.3rem 0 darken($active_theme, 15%));
                margin: 0;
            }
        }
    }

    .__sidebar-info {
        background-color: $active_theme;
        display: flex;
        flex: 1 0 auto;
        flex-direction: column;
        transition: all $anim-time $anim-ease;
        word-break: break-all;

        > div {
            padding: 0.75rem;
            transition: all $anim-time ease-out;

            &:not(.__sidebar-count) {
                flex: 1;
            }
        }

        hr {
            margin: 0.75rem 0;
        }

        table {
            margin-bottom: 0.25rem;

            td {
                font-size: 1rem;
                vertical-align: top;
            }

            .t-key {
                color: darken($active_theme, 25%);
                white-space: nowrap;
            }

            .t-val {
                color: darken($active_theme, 75%);
                padding-left: 5px;
                word-break: break-word;
            }

            a {
                color: $blue;
            }
        }
    }

    .__sidebar-zip {
        align-items: center;
        display: flex;

        .icon {
            display: block;
        }

        form {
            margin-top: -1px;
        }
    }

    .__sidebar-count {
        color: darken($active_theme, 50%);
        display: flex;
        flex-direction: row-reverse;
        justify-content: space-evenly;
        margin-top: 3rem;
        white-space: nowrap;

        > div {
            text-align: center;

            &:not(:first-of-type) {
                border-right: 1px solid darken($active_theme, 10%);
            }

            &:not(:only-of-type) {
                flex: 1;
                transition: all $anim-time $anim-ease;
            }

            &:only-of-type {
                margin-left: auto;
            }
        }

        .__sidebar-count-bulk {
            span.icon,
            span.is-5 {
                bottom: 6px;
                position: relative;
            }
        }

        .title {
            color: darken($active_theme, 50%);
            line-height: 1;
            margin: 0 !important;

            svg {
                fill: darken($active_theme, 50%);
            }
        }
    }
}

.__sidebar-swipe-hidden {
    width: 1.5rem;
    z-index: 1;
}

.svg-prev-icon {
    margin: 4rem 0;
}

/*                movable                */
.movable-list {
    background: $white;
    border-radius: 100vw;
    cursor: pointer;
    position: relative;
    transition: all $anim-time;

    .counter {
        background: $red;
        border-radius: 100vw;
        color: $white;
        font-size: 0.75rem;
        font-weight: bold;
        line-height: 1;
        padding: 0.25rem 0.5rem;
        position: absolute;
        right: -0.5rem;
        top: -0.5rem;
        z-index: 1;

        &:empty {
            display: none;
        }
    }

    &:hover {
        box-shadow: 0 15px 30px 0 rgba($black, 0.05), 0 5px 15px 0 rgba($black, 0.08);
        color: $black;
        transform: translateY(-0.7rem);
    }
}

.media.link {
    border: 2px dashed transparent;
    border-radius: 4px;
    margin-top: 0.5rem;
    padding: 0.5rem;
    transition: all $anim-time * 2 ease-in-out;

    &:hover {
        border-color: darken($active_theme, 5%);
        transform: translateY(-0.15rem);
    }
}

/*                modal                */
.__modal-content-wrapper {
    align-self: center;
}

.__modal-preview {
    .title {
        word-break: break-all;
    }

    .subtitle {
        color: darken($active_theme, 50%);
    }

    .icon {
        border-radius: 4px;
    }

    .modal-content {
        margin: 0;
        max-width: 25vw;
        width: auto;
    }

    .card-image {
        border-bottom: 1px solid darken($active_theme, 5%);
        overflow-y: scroll;
    }

    .pdf-prev {
        .card-image {
            height: 25vh;

            object {
                display: block;
                height: 100%;
                width: 100%;
            }
        }
    }

    .audio-prev {
        border-bottom: 1px $dashed-border;

        .audio-icon {
            background-color: $active_theme;
            height: 100%;
            text-align: center;
            width: 100%;
        }

        audio {
            z-index: 1;
        }
    }
}

@include media('max', 1023) {
    .__modal-preview {
        .modal-content {
            max-width: 50vw;
        }
    }
}

@include media('max', 768) {
    .__modal-preview {
        .modal-content {
            max-width: 100%;
        }
    }
}

.card-details {
    margin-bottom: 1rem;

    .tag {
        background: $application;
        color: $white;
        font-size: 1rem;
    }
}

.__modal-delete-total {
    margin-top: 1rem;
    padding-top: 1rem;
    text-align: right;
}

.__modal-folder-warning {
    align-items: flex-end;
    display: flex;
    margin-top: 1rem;
}

/*                Options                */

/* manager in modal */
.modal-manager__Inmodal {
    > .modal-content {
        width: 85%;
    }

    .__stack-breadcrumb-mobile {
        padding-bottom: 1rem;
    }

    .media-manager__stack {
        overflow: hidden;

        &::before {
            box-shadow: none;
        }
    }

    .__stack-sidebar {
        max-height: 65vh;
        overflow: scroll;
    }

    .__stack-sidebar-toggle {
        span:not(.icon) {
            margin-bottom: 0;
        }
    }

    .__box-copy-link {
        bottom: 1px;
        right: 0;
    }

    .__modal-preview {
        .modal-content {
            width: 100%;
        }
    }
}

@include media('max', 1023) {
    .modal-manager__Inmodal {
        .modal-content {
            width: 95%;
        }
    }
}

.__Inmodal-editor,
.__Inmodal-editor-hide {
    display: none;
}

/* reverse manager top / bottom toolbar */
.__stack-reverse {
    .media-manager__stack {
        flex-direction: column-reverse;
    }

    .__stack-breadcrumb {
        border-bottom: 1px solid $breadcrumb;
        border-top: none;
        z-index: 1;
    }
}

/* reverse container left / right columns */
.__stack-files-reverse {
    .__stack-container {
        flex-direction: row-reverse;
    }

    .__stack-files {
        left: 0;
        right: 20%;
    }

    .__stack-sidebar-hidden {
        right: 0;
    }

    .__stack-sidebar {
        border-left: 1px solid darken($active_theme, 5%);
        border-right: none;

        .__sidebar-count {
            flex-direction: row;

            > div {
                &:not(:first-of-type) {
                    border-left: 1px solid darken($active_theme, 10%);
                    border-right: none;
                }

                &:only-of-type {
                    margin-left: 0;
                    margin-right: auto;
                }
            }
        }
    }

    // animation
    .mm-slide-enter,
    .mm-slide-leave-to {
        transform: translateX(0.7rem);
    }
}

/*                Progress bar                */
.progress-bar strong {
    display: none;
}

.extra-func-btns {
    bottom: $option_btns-space;
    position: absolute;
    right: $option_btns-space;
    z-index: 2;
}
